//
//  WelfareListenTableViewCell.swift
//  TianTianBiTing
//
//  Created by Gox mac 2 on 2019/2/22.
//  Copyright © 2019 Gox_WallyDiao. All rights reserved.
//

import UIKit

class WelfareListenTableViewCell: UITableViewCell {
    var backImage:UIImageView = UIImageView()
    var rankingImage:UIImageView = UIImageView()
    var rankingLabel:UILabel = UILabel()
    var headImage:UIImageView = UIImageView()
    var nameLabel:UILabel = UILabel()
    var numberLabel:UILabel = UILabel()
    var unitlLable:UILabel = UILabel()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        setUI()
    }
    
    
    func setUI() {
        backImage.backgroundColor = UIColor.white
        backImage.layer.cornerRadius = 4
        backImage.image = IMAGE(name: "rankingSlice")
        
        contentView.addSubview(backImage)
        
        contentView.addSubview(rankingImage)
        
        rankingLabel.font = Font_Medium(17)
        rankingLabel.textAlignment = .center
        rankingLabel.textColor = RGB_Same(12)
        contentView.addSubview(rankingLabel)
        
        headImage.layer.cornerRadius = 16
        headImage.layer.masksToBounds = true
        contentView.addSubview(headImage)
        
        nameLabel.font = Font_Medium(13)
        nameLabel.textColor = RGB_Same(12)
        contentView.addSubview(nameLabel)
        
        numberLabel.font = Font_Bold(17)
        numberLabel.textColor = RGB(230, 67, 64)
        numberLabel.textAlignment = .right
        contentView.addSubview(numberLabel)
        
        unitlLable.font = Font_Medium(11)
        unitlLable.textColor = RGB(230, 67, 64)
        contentView.addSubview(unitlLable)
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    override func layoutSubviews() {
        backImage.frame = FRAME_CGFloat(10, 0, SCREEN_WIDTH - 20, 48)
        rankingImage.frame = FRAME_CGFloat(17.5, 13, 32, 24)
        rankingLabel.frame = FRAME_CGFloat(17.5, 13, 32, 24)
        headImage.frame = FRAME_CGFloat(58.5, 10.7, 31.3, 31.3)
        nameLabel.frame = FRAME_CGFloat(100, 15, SCREEN_WIDTH - 250, 18.5)
        numberLabel.frame = FRAME_CGFloat(SCREEN_WIDTH - 150, 13, 100, 24)
        unitlLable.frame = FRAME_CGFloat(SCREEN_WIDTH - 40, 18.5, 22, 15)
        
    }

}
